package com.leetcode.LC_MED;

import java.util.Arrays;
import java.util.List;

public class LC1456 {
    public int maxVowels(String s, int k) {

        int a = 0, b = 0, count = 0, max = 0;
        List<Character> list = Arrays.asList('a', 'e', 'i', 'o', 'u');
        while (b < k) {
            if (list.contains(s.charAt(b))) {
                count++;
            }
            b++;
        }
        b--;
        max = count;
        //a=0,b=k-1;
        while (b < s.length()) {
            a++;
            b++;
            if (list.contains(s.charAt(a - 1))) {
                count--;
            }
            if (b < s.length() && list.contains(s.charAt(b))) {
                count++;
            }
            max = Math.max(max, count);
        }
        return max;
    }

    public static void main(String[] args) {
        System.out.println(new LC1456().maxVowels("weallloveyou", 7));
    }
}
